lib/deltas: Squash some GCC maybe-uninitialized warnings
authorColin Walters <walters@verbum.org>
Thu, 22 Mar 2018 17:11:07 +0000 (13:11 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 22 Mar 2018 19:30:16 +0000 (19:30 +0000)
These show up in the RPM build, I didn't yet try to figure out why we're not
reproducing them outside of that.

Closes: #1510
Approved by: jlebon

src/libostree/ostree-repo-static-delta-compilation.c
src/libostree/ostree-repo-static-delta-core.c

index 746a1a506197c4da64dbc025197a6860b8a061a5..9084a72f5e866f5f7e2b3606369069bd23b185e5 100644 (file)
@@ -241,14 +241,8 @@ finish_part (OstreeStaticDeltaBuilder *builder, GError **error)
     g_variant_builder_add_value (&xattr_builder, part_builder->xattrs->pdata[j]);
 
   {
-    g_autoptr(GBytes) payload_b;
-    g_autoptr(GBytes) operations_b;
-
-    payload_b = g_string_free_to_bytes (part_builder->payload);
-    part_builder->payload = NULL;
-
-    operations_b = g_string_free_to_bytes (part_builder->operations);
-    part_builder->operations = NULL;
+    g_autoptr(GBytes) payload_b = g_string_free_to_bytes (g_steal_pointer (&part_builder->payload));
+    g_autoptr(GBytes) operations_b = g_string_free_to_bytes (g_steal_pointer (&part_builder->operations));
 
     delta_part_content = g_variant_new ("(a(uuu)aa(ayay)@ay@ay)",
                                         &mode_builder, &xattr_builder,
index bca638b21d2b6143d6987d4cae2e05b82b641f4d..68b06b5ce25a92d4b2fba335dbddb18a8da90185 100644 (file)
@@ -38,10 +38,8 @@ _ostree_static_delta_parse_checksum_array (GVariant      *array,
                                            guint         *out_n_checksums,
                                            GError       **error)
 {
-  gsize n = g_variant_n_children (array);
-  guint n_checksums;
-
-  n_checksums = n / OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN;
+  const gsize n = g_variant_n_children (array);
+  const guint n_checksums = n / OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN;
 
   if (G_UNLIKELY(n > (G_MAXUINT32/OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN) ||
                  (n_checksums * OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN) != n))
@@ -166,8 +164,8 @@ _ostree_repo_static_delta_part_have_all_objects (OstreeRepo             *repo,
                                                  GCancellable           *cancellable,
                                                  GError                **error)
 {
-  guint8 *checksums_data;
-  guint n_checksums;
+  guint8 *checksums_data = NULL;
+  guint n_checksums = 0;
   gboolean have_object = TRUE;
 
   if (!_ostree_static_delta_parse_checksum_array (checksum_array,